package com.hzy.context;

import java.util.Objects;

/**
 * @author huangzhenyu
 * @date 2024/9/10 22:13
 */
public class ApplicationContextUtils {


    private static ApplicationContext applicationContext;

    public static ApplicationContext getRequiredApplicationContext() {
        return Objects.requireNonNull(getApplicationContext(), "ApplicationContext is not set.");
    }

    public static ApplicationContext getApplicationContext() {
        return applicationContext;
    }

    static void setApplicationContext(ApplicationContext ctx) {
        applicationContext = ctx;
    }

}
